Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect lighthouse CI on each frontend change #4994

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

sarayourfriend
Copy link
Collaborator

@sarayourfriend sarayourfriend commented Sep 26, 2024

Fixes

Fixes #646 by @obulat

Description

This PR adds a new CI/CD job to collect Lighthouse CI results for each frontend change.

Testing Instructions

The new CI job must pass.... click in to see the nice table of results logged in the "Display Report" step

For now, that's as far as we'll go. It's already telling us some pretty useful (and worrisome!) things. In the future we can explore other methods of displaying results (e.g., https://www.foo.software/docs/lighthouse-check-github-action/intro, which requires a small amount of additional infrastructure work to get running, S3 and some IAM stuff). See this comment for more details about why other free and easy options are not currently available.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • [N/A] I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • [N/A] I tried running the project locally and verified that there are no visible errors.
  • [N/A] I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend added 🟩 priority: low Low priority and doesn't need to be rushed 🌟 goal: addition Addition of new feature ♿️ aspect: a11y Concerns related to the project's accessibility 🧱 stack: frontend Related to the Nuxt frontend 🧱 stack: infra Related to the Terraform config and other infrastructure labels Sep 26, 2024
@openverse-bot openverse-bot added 🧱 stack: mgmt Related to repo management and automations 💻 aspect: code Concerns the software code in the repository labels Sep 26, 2024
Copy link

github-actions bot commented Sep 26, 2024

Latest k6 run output1

$     ✓ status was 200

     checks.........................: 100.00% ✓ 8000      ✗ 0   
     data_received..................: 1.8 GB  8.3 MB/s
     data_sent......................: 1.0 MB  4.8 kB/s
     http_req_blocked...............: avg=8.5µs    min=1.23µs  med=2.43µs   max=4.48ms  p(90)=3.56µs   p(95)=3.86µs  
     http_req_connecting............: avg=4.7µs    min=0s      med=0s       max=4.44ms  p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=567.03ms min=50.73ms med=506.07ms max=2.53s   p(90)=1.06s    p(95)=1.18s   
       { expected_response:true }...: avg=567.03ms min=50.73ms med=506.07ms max=2.53s   p(90)=1.06s    p(95)=1.18s   
   ✓ http_req_failed................: 0.00%   ✓ 0         ✗ 8000
     http_req_receiving.............: avg=163.76µs min=40.31µs med=110.28µs max=32.82ms p(90)=182.52µs p(95)=242.05µs
     http_req_sending...............: avg=22.47µs  min=6.81µs  med=18.89µs  max=4.38ms  p(90)=25.77µs  p(95)=32.41µs 
     http_req_tls_handshaking.......: avg=0s       min=0s      med=0s       max=0s      p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=566.85ms min=50.59ms med=505.94ms max=2.53s   p(90)=1.06s    p(95)=1.18s   
     http_reqs......................: 8000    36.535807/s
     iteration_duration.............: avg=3.78s    min=1.23s   med=3.08s    max=10.73s  p(90)=8.22s    p(95)=8.81s   
     iterations.....................: 1200    5.480371/s
     vus............................: 1       min=1       max=30
     vus_max........................: 30      min=30      max=30

Footnotes

  1. This comment will automatically update with new output each time k6 runs for this PR

@sarayourfriend sarayourfriend marked this pull request as ready for review September 26, 2024 02:06
@sarayourfriend sarayourfriend requested a review from a team as a code owner September 26, 2024 02:06
@sarayourfriend sarayourfriend requested review from krysal and obulat and removed request for a team September 26, 2024 02:06
@sarayourfriend
Copy link
Collaborator Author

Ah, what a shame, the free "temporary public storage" that is used by Lighthouse CI to support the GitHub app's functionality is (hopefully temporarily) broken: GoogleChrome/lighthouse-ci#1072

We can move forward with this PR as is, and spin up our own Lighthouse CI server on ECS in the meantime. In any case, collecting and running LHCI is the first step to either the publicly available free integration, or an Openverse-specific one where we run the server ourselves (if the free one doesn't come back).

Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to finally have this done, thank you!
I left a couple of questions, but they are non-blockers.

setup_python: false
install_recipe: node-install

- name: Run build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reuse the built Nuxt app for this and for the k6?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need to push the .nuxt directory as an artifact, I think, but it should be possible. It only takes 32-seconds though. Downloading and decompressing the artifact could take just as long.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building makes more sense, considering the time it takes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nuxt 3 made it a lot better 🙂

run: |
pnpm --package=@lhci/cli dlx lhci autorun --config .github/.lighthouserc.yml

- name: Display Report
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add it as a comment on the PR? Or do you think that would be too much?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other actions out there that generate markdown tables, but they all looked pretty bad (too information dense) and the comments would be very long (similar to the old bundle size comments).

I think we should think of ways of making the results more noticeable, but those would probably come more from writing assertions so that the check fails when we get results we don't want. Lighthouse CI recommends you wait to add assertions until after you've had a chance to understand your results and make changes to improve them a bit first.

Ultimately, I think this action would be the best thing, once we are comfortable in our understanding of what we want from Lighthouse. That action requires setting up access to S3 for saving the files, which I'd prefer to do as a separate step to this one of just getting it running.

@sarayourfriend sarayourfriend merged commit 3fe95ae into main Sep 26, 2024
67 checks passed
@sarayourfriend sarayourfriend deleted the add/lighthouse-ci-frontend branch September 26, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♿️ aspect: a11y Concerns related to the project's accessibility 💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: frontend Related to the Nuxt frontend 🧱 stack: infra Related to the Terraform config and other infrastructure 🧱 stack: mgmt Related to repo management and automations
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement Lighthouse CI (original #1130)
3 participants